new Vue({
    el: "#withdrawals",
    data: {
        userInfo: {},
        withdrawalsLog:{}
    },
    methods: {
        getUserMoenyInfo: function() {
            var _this = this;
            $.get(
                '/withdrawals/getUserMoenyInfo',
                function(reg) {
                    if (reg.status == "success") {
                        console.log(reg.data);
                        _this.userInfo = reg.data
                    } else if (reg.status == "failed") {
                        layer.msg(reg.data, { icon: 2 });
                    }

                }
            )
        },
        getWithdrawalsLog:function(){
        	var _this = this;
            $.get(
                '/withdrawals/getWithdrawalsLog',
                function(reg) {
                    if (reg.status == "success") {
                        _this.withdrawalsLog = reg.data.data;
                        $(".page").twbsPagination({
                                prev: '前一页',
                                next: '下一页',
                                totalPages: reg.data.totalPage,
                                visiblePages: 5,
                                onPageClick: function(event, page) {
                                    $.post(
                                        "/withdrawals/getWithdrawalsLog", {
                                            page: page
                                        },
                                        function(ret) {
                                            if(ret.status == "success"){
                                                _this.withdrawalsLog = ret.data.data;
                                                //that.cashAppend(reg.data.info);
                                            }else{
                                                //$("#tixian").append("<tr><td colspan='6' style='text-align:center;'>还没有提现记录</td></tr>");
                                            }
                                        }
                                    );
                                }
                            });
                    } else if (reg.status == "failed") {
                        layer.msg(reg.data, { icon: 2 });
                    }
                }
            )
        },
        withdrawalsForm: function(typeid,id) {
            var _this = this;
            window.location.href="/withdrawals/addWithdrawalsLog?typeid="+typeid+"&id="+id;
        },
        contentDom: function() {
            var html = "fafhak";

        }
    },
    ready: function() {
        this.getUserMoenyInfo();
        this.getWithdrawalsLog();
    }
});
